﻿using System.Web.Mvc;
using Mysoft.Platform.Component.Attributes;
using Mysoft.Platform.OnlineLibrary.BaseControllers;
using Mysoft.Platform.OnlineLibrary.Models;

namespace Mysoft.Platform.OnlineLibrary.Controllers
{
	[Auth(UserGroup.Admin)]
	public class BookManageController : BaseController
	{
		//
		// GET: /BookDetail/

		public ActionResult Index(int? option, BookModel model)
		{
			if( option != null && option == 1 )
			{
				//add
				if( model != null && !string.IsNullOrEmpty(model.BookName))
				{
					Add(model);
					ViewBag.Info = "添加成功";
				}
			}
			
			return View(model);
		}

		private void ValidModel(BookModel model)
		{
			
		}

		private JsonResult Add(BookModel model)
		{
			return Json("{success: '1'}");
		}

		public JsonResult Edit()
		{
			return Json("{success: '1'}");			
		}
	}
}